Metaschema
Metadata schema and interface (contract) definition language
Installation
$ npm install metaschema
Examples
const { Schema } = require('metaschema');
const schema = Schema.from({
name: {
first: 'string',
last: 'string',
third: '?string',
},
age: 'number',
levelOne: {
levelTwo: {
levelThree: { type: 'enum', enum: [1, 2, 3] },
},
},
collection: { array: { array: 'number' } },
});
const data = {
name: {
first: 'a',
last: 'b',
},
age: 5,
levelOne: { levelTwo: { levelThree: 1 } },
collection: [
[1, 2, 3],
[3, 5, 6],
],
};
console.log(schema.check(data));
License & Contributors
Copyright (c) 2017-2024 Metarhia contributors.
Metaschema is MIT licensed.
Metaschema is a part of Metarhia technology stack.